package com.wuhongyu.repository;

import com.wuhongyu.base.BaseDao;
import com.wuhongyu.entity.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface UserDao extends BaseDao<User> {

    /**
     * 登录
     * @param username
     * @param password
     * @return
     */
    @Query(value = "select * from user where username =:username and password=:password",nativeQuery = true)
    User login(@Param("username") String username, @Param("password")String password);

    /**
     * 查找非超级管理员的用户
     * @param type
     * @return
     */
    List<User> findByTypeIsNot(String type);
}
